<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2022/4/24
  Time: 20:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

    <%
        pageContext.setAttribute("APP_PATH", request.getContextPath());
    %>

    <script src="http://code.jquery.com/jquery-3.4.1.js"></script>
</head>
<body>

    <div class="container">
        <div class="row">
            <div>
                <h1>SSM_CRUD</h1>
            </div>
        </div>

        <div class="row">
            <div>
                <button>新增</button>
                <button>删除</button>
            </div>
        </div>

        <div class="row">
            <table id="emps_table">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>empName</th>
                        <th>gender</th>
                        <th>email</th>
                        <th>deptName</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>

        <div class="row"></div>

    </div>

<script type="text/javascript">

    $(function () {
        to_page(1)
    });

    function to_page(pn) {
        $.ajax({
            url:"${APP_PATH}/emps",
            data:"pn=" + pn,
            type:"POST",
            success:function (result) {
                emp_table_info(result);
            }
        })
    }

    function emp_table_info(result) {
        $("#emps_table").empty();

    }

</script>

</body>
</html>
